extends Spatial

const particle_scene: PackedScene = preload("res://effects/BallParticle.tscn")
const radius: float = 1.02
const particle_count: int = 192

func _ready():
# warning-ignore:unused_variable
	for i in range(particle_count):
		var v: Vector3
		while true:
			v = Vector3(rand_range(-1.0, 1.0), rand_range(-1.0, 1.0), rand_range(-1.0, 1.0))
			var l = v.length_squared()
			if l >= 0.01 and l <= 1.0:
				v = v.normalized() * radius
				break

		var p: Spatial = particle_scene.instance()
		p.transform.origin = v
		add_child(p)

# warning-ignore:unused_argument
func _process(delta):
	if get_child_count() == 0 and not is_queued_for_deletion():
		queue_free()
